import { FC } from "react";
import { QuestionInfoDefaultProps, QuestionInfoPropsType } from "./interface";
import { Typography } from "antd";
const { Title, Paragraph } = Typography;
export const QuestionTitle: FC<QuestionInfoPropsType> = (
  props: QuestionInfoPropsType
) => {
  const { text = "", desc = "" } = {
    ...QuestionInfoDefaultProps,
    ...props,
  };
  const tr = desc.split("\n");
  return (
    <div>
      <Title level={3} className="text-center">
        {text}
      </Title>
      <Paragraph className="text-center">
        {tr.map((c, index) => (
          <span key={index}>
            {index > 0 && <br />}
            {c}
          </span>
        ))}
      </Paragraph>
    </div>
  );
};

export default QuestionTitle;
